package xuexi;


import java.time.format.TextStyle;

class SoloModelTest{
    //private static SoloModelTest soloModelTest=new SoloModelTest();       //普通单例模式
    private static SoloModelTest soloModelTest;                        //懒汉式

    private SoloModelTest() { }
    public static SoloModelTest getInstance(){
        if (soloModelTest==null){                       //第一次使用
            soloModelTest=new SoloModelTest();          //实例化对象
        }
        return soloModelTest;
    }
    public void getInfo(){
        System.out.println("单例模式!");
    }
}
public class Soloodel {
    public static  void main(String[] args){
        SoloModelTest Test=null;
        Test=SoloModelTest.getInstance();
        Test.getInfo();
    }
}
